package com.csl.jsonpreference.ui

import android.util.Log
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.viewbinding.ViewBinding
import com.csl.jsonpreference.databinding.ItemTxtBaseBinding
import com.csl.ui.base.adapter.QuickAdapter


/**
 * 单纯文本adapter
 * <br>doc by: cs_lius
 * <br>e-mail: cs_lius@126.com
 * <br>created at 2022/2/23 15:26:27
*/
open class TextAdapter<T>(
//    onItemClickListener: ((position: Int, data: T) -> Unit)? = null,
//    onItemLongClickListener: ((position: Int, data: T) -> Unit)? = null
) : QuickAdapter<T, ItemTxtBaseBinding>(
//    onItemClickListener,
//    onItemLongClickListener
) {
    override fun onBindItem(holder: ItemTxtBaseBinding, position: Int, data: T): ViewBinding {
        return holder.apply {
            Log.e("csl_test_adapter", "设置数据:$data")
            this.tvMsg.setText("$data")
        }

    }

    override fun onCreateItem(parent: ViewGroup, viewType: Int): ItemTxtBaseBinding {
        return ItemTxtBaseBinding.inflate(LayoutInflater.from(parent.context), parent, false)
    }
}